﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SpriteGame.Rendering;

namespace SpriteGame.Effects.Particles
{
    class Particle
    {
        private Vector2 position;
        private Vector2 velocity;
        private Texture2D texture;
        private Color color;
        private bool alive;
        public bool Alive
        {
            get { return alive; }
        }

        public Particle()
        {

        }

        public void InitParticle(Vector2 _position, Vector2 _velocity, Texture2D _texture, Color _color)
        {
            alive = true;
            position = _position;
            velocity = _velocity;
            texture = _texture;
            color = _color;
        }

        public virtual void Update()
        {
            position += velocity;
//if (position.X < 0 || position.X > 1200 || position.Y < 0 || position.Y > 1000)
          //  {
              //  alive = false;
           // }
        }

        public virtual void Draw(ShapeRenderer _batch)
        {
            if (alive)
            {
                _batch.DrawQuad(position, 0.0f, texture.Width, texture.Height, texture);
            }
        }
    }
}
